<template>
    <div class="field-container" v-loading="config.loading">
        <el-empty :description="config.message" v-if="config.is_faild">
            <el-text type="warning">
                <el-icon>
                    <WarningFilled />
                </el-icon>
                请联系管理员开通权限</el-text>
        </el-empty>
    </div>
</template>
<script setup>
import { post, URL, Thread } from '@/tool/common';
import { ElMessage } from 'element-plus';
import { onMounted, reactive, ref } from 'vue';

const config = reactive({
    is_faild: false,
    message: "加载中",
    loading: true
})

onMounted(() => {
    config.loading = true;
    Thread(() => {
        post({
            url: URL.BASE + URL.API_CONFIG_TABLE,
            data: {
                token: Cookies.get("token")
            }
        }).then(res => {
            if (res) {
                const code = res.code;
                if (code === 500) {
                    config.is_faild = true;
                    config.message = res.msg || "认证失败";
                } else if (code === 200) {
                    config.is_faild = false;
                }
            }
        }).catch(err => {
            ElMessage.alert('获取数据错误')
        }).finally(() => {
            config.loading = !1
        });
    }).wait(560);
});
// 配置页面 需要管理员权限



</script>
<style scoped lang="scss"></style>